function tianjiatq(){
	var orgName =$("#name").val();
	var phoneNumber =$("#phoneNumber").val();
	var accountNumber =$("#accountNumber").val();
	var passowrd=$("#password").val();
	var birthday =$("#birthday").val();
	var imgFile =$("#imgFile").val();
	if(imgFile.length==0 || imgFile==""){
		layer.alert("请选择要上传的头像！");
		window.orgAdmin.document.getElementById("imgFile").focus();
		return;
	}
	var lengths=/^.{2,4}$/;
	if(orgName.length==0 || orgName==""){
		layer.alert("角色名称不能为空！");
		window.orgAdmin.document.getElementById("name").focus();
		return;
	}
	if(!lengths.test(orgName)){
		layer.alert("请输入2-4 个字符！");
		return false;
	}
	//验证只包含字母或者汉字
	var pattern =/(^[\u4e00-\u9fa5A-Za-z0-9_-]*$)/;
	//验证不能为纯数字
	var patternNum=/^\d+$/;
	if (!pattern.test(orgName)) {
		layer.alert("请输入合法的角色名称！");
		return false;
	}
	if (patternNum.test(orgName)) {
		layer.alert("角色名称不能为纯数字！");
		return false;
	}
	if(phoneNumber.length==0 || phoneNumber==""){
		layer.alert("账号不能为空！");
		window.orgAdmin.document.getElementById("phoneNumber").focus();
		return;
	}
	if(accountNumber.length==0 || accountNumber==""){
		layer.alert("后台登陆账号不能为空！");
		window.orgAdmin.document.getElementById("accountNumber").focus();
		return;
	}
	if(passowrd.length==0 || passowrd==""){
		layer.alert("密码不能为空！");
		window.orgAdmin.document.getElementById("passowrd").focus();
		return;
	}
	if(!(/^1[34578]\d{9}$/.test(phoneNumber))){
		layer.alert("不是完整的11位手机号或者正确的手机号前七位！");
		window.orgAdmin.document.getElementById("phoneNumber").focus();
		return;
	}
	if(birthday.length==0 || birthday==""){
		layer.alert("请选择你的生日！");
		window.orgAdmin.document.getElementById("birthday").focus();
		return;
	}
	if(!( /^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/.test(birthday))){
		layer.alert("请输入正确的日期格式！");
		window.orgAdmin.document.getElementById("birthday").focus();
		return;
	}
	

    var layer_load_window = layer.load(2); 
    $("#form-teacher-add").ajaxSubmit({
		dataType : 'text',
        success: function(message){
        		if(message == "200"){
                    layer.msg('操作成功!',{icon:1,time:1000},function(){
                    	parent.window.location.reload();
                    });
 				}else if(message == "201"){
 					 layer.msg('此账号已存在!',{icon:1,time:1000},function(){

 				});
 				}
 				else if(message == "503"){
					 layer.msg('不存在此机构!');
				}
 				else if(message == "500"){
 					
 				}else if(message == "202"){
 					layer.alert("图片格式不正确！");
 				}
 				else if(message == "404"){
 					layer.alert("请选择你的头像！");
 				}
 				else{	
 					layer.alert(message);
 				}
        },
        error: function(){
            layer.msg('操作失败!',{icon:5,time:1000});
        },complete: function(XMLHttpRequest, textStatus) {
        	layer.close(layer_load_window);
        }
    });
}

